/**
 * 
 */
package com.treehouse.northlight.screen;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.math.Rectangle;
import com.treehouse.northlight.core.Northlight;

/**
 * @author jbiermann
 * @version 1.0 05.03.2013
 * 
 */
public class MainMenuScreen implements Screen {

	private Northlight game;

	/*
	 * Testing purpose Objects
	 */
	private ShapeRenderer shapeRender;
	private Rectangle rec;

	/**
	 * Constructor
	 */
	public MainMenuScreen(Northlight game) {
		this.game = game;
		this.rec = new Rectangle(50, 50, 100, 100);
	}

	/**
	 * @see com.badlogic.gdx.Screen#show()
	 */
	@Override
	public void show() {
		this.shapeRender = new ShapeRenderer();
	}

	/**
	 * @see com.badlogic.gdx.Screen#resume()
	 */
	@Override
	public void resume() {
		// TODO Auto-generated method stub

	}

	/**
	 * @see com.badlogic.gdx.Screen#resize(int, int)
	 */
	@Override
	public void resize(int width, int height) {

	}

	/**
	 * @see com.badlogic.gdx.Screen#hide()
	 */
	@Override
	public void hide() {

	}

	/**
	 * @see com.badlogic.gdx.Screen#pause()
	 */
	@Override
	public void pause() {
		// TODO Auto-generated method stub
	}

	/**
	 * @see com.badlogic.gdx.Screen#render(float)
	 */
	@Override
	public void render(float delta) {
		Gdx.gl10.glClearColor(0.3f, 0.6f, 0.9f, 1.0f);
		Gdx.gl10.glClear(GL10.GL_COLOR_BUFFER_BIT);
		this.game.getOrthoCamera().update();
		this.game.getSpriteBatch().setProjectionMatrix(
				this.game.getOrthoCamera().combined);
		this.shapeRender.setColor(0, 0, 0, 1);
		this.shapeRender
				.setProjectionMatrix(this.game.getOrthoCamera().combined);
		this.shapeRender.begin(ShapeType.FilledRectangle);
		this.shapeRender.filledRect(this.rec.x, this.rec.y, this.rec.width,
				this.rec.height);
		this.shapeRender.end();

		if (Gdx.input.isTouched())
			this.game.setScreen(this.game.getScreens()[1]);
	}

	/**
	 * @see com.badlogic.gdx.Screen#dispose()
	 */
	@Override
	public void dispose() {
		this.shapeRender.dispose();
	}
}
